package cn.leaf.service.impl;

import cn.leaf.api.HelloDubboService;
import cn.leaf.entity.StarEntity;
import cn.leaf.service.DubboConsumerService;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;

/**
 *
 * description: dubbo consumer interface implements
 *
 * @author Cyril
 * @version v1.0.0
 * @since 2021-05-24 23:42:27
 *
 */
@Service
public class DubboConsumerServiceImpl implements DubboConsumerService {

    /**
     * set dubbo interface version , check: false don't check dubbo provider startup order
     * if use local registry require to use "url = 'dubbo://127.0.0.1:{dubbo provider port}'"
     */
    @DubboReference(version = "1.0.0", check = false, retries = 3, timeout = 2000)
    private HelloDubboService helloDubboService;

    @Override
    public String helloDubbo() {
        return helloDubboService.helloDubbo();
    }

    @Override
    public StarEntity starInfo() {
        return helloDubboService.starInfo();
    }
}
